import base from "@src/store/base";
import {storeBindingsBehavior} from "mobx-miniprogram-bindings";

Component({
  behaviors: [storeBindingsBehavior],
  storeBindings: [{
    store: base,
    fields: ['themeColor', 'themeTitleColor']
  }],
  properties: {
    groupInfo:{
      type: Object,
      value: null,
      observer(newVal, oldVal, changedPath) {
        if(newVal.leaderCollect) this.setData({leaderCollect:newVal.leaderCollect})
        if(newVal.leaderCollectType) this.setData({leaderCollect:newVal.leaderCollectStatus})
        this.triggerEvent("handleLeaderCollect",this.data.leaderCollect)
      }
    },

    store:{
      type:Object,
      value:null
    }
  },
  observers: {

  },
  data: {
    leaderCollect:false
  },

  methods: {
    changeLeaderCollect(){
      this.setData({leaderCollect:!this.data.leaderCollect});
      this.triggerEvent("handleLeaderCollect",this.data.leaderCollect)
    },
    handleReservedPhone(e){
      this.triggerEvent('handleReservedPhone',e.detail.value)
    }
  }
});
